using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

namespace CPGVertragsverwaltung.ErrorHandling
{
    class EventLogger
    {
        String mLogSource = "CPGVertragsverwaltung";
        String mLogGroup = "Application";

        public EventLogger()
        {
            if (!EventLog.SourceExists(mLogSource))
                EventLog.CreateEventSource(mLogSource, mLogGroup);
        }

        /// <summary>
        /// Add an Error Event
        /// </summary>
        /// <param name="pLogText">Message</param>
        public void addError(String pLogText)
        {
            EventLog.WriteEntry(mLogSource, pLogText, EventLogEntryType.Error);
        }

        /// <summary>
        /// Add an Warning Event
        /// </summary>
        /// <param name="pLogText">Message</param>
        public void addWarning(String pLogText)
        {
            EventLog.WriteEntry(mLogSource, pLogText, EventLogEntryType.Warning);
        }

        /// <summary>
        /// Add an Error Event
        /// </summary>
        /// <param name="pLogText">Message</param>
        public void addInformation(String pLogText)
        {
            EventLog.WriteEntry(mLogSource, pLogText, EventLogEntryType.Information);
        }
    }
}
